<template>
  <div class="xtx-bread-item">
    <router-link v-if="to" :to="to">
      <slot />
    </router-link>
    <span v-else>
      <slot />
    </span>
    <i>{{ separator }}</i>
  </div>
</template>

<script lang="ts">
export default {
  name: 'XtxBreadItem'
}
</script>

<script setup lang="ts">
import { inject } from 'vue'

defineProps({
  to: {
    type: String,
    default: ''
  }
})

const separator = inject('separator')


</script>

<style lang="less" scoped>
.xtx-bread-item {
  // 最后一个i隐藏
  &:nth-last-of-type(1) {
    i {
      display: none;
    }
  }
}
</style>